package controllers;

import java.util.List;
import java.util.Locale;

//import nekperu15739.me.menu.MenuItem;
//import nekperu15739.me.services.MenuService;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class IndexController {
	
//	@Autowired
//	private MenuService menuService;

	@SuppressWarnings("unused")
	@RequestMapping(value = { "/index" })
	public String index(Model model, Locale aLocale) {
		String language = aLocale.getLanguage();
//		List<MenuItem> menu = menuService.loadMenuByLanguaje(language);
//		model.addAttribute("menu", menu);
		
		// http://frontend-nekperu15739.cloudfoundry.com/
//		model.addAttribute("path", "/frontend-nekperu15739/resources/");
//		model.addAttribute("path", "/frontend/resources/");
//		model.addAttribute("urlBase", "http://localhost:8080/frontend-nekperu15739/");
		// model.addAttribute("path", "/resources/");
		
		 return "index";
//		return "home";
	}

	@Autowired
	EmployeeService employeeService;

	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	@ResponseBody
	public EmployeeDTO findEmployee(@PathVariable("id") long employeeId) {
		return employeeService.findEmployee(employeeId);
	}

	@RequestMapping(value = "/json/{id}", method = RequestMethod.GET, headers = { "Accept=application/json" })
	@ResponseBody
	public EmployeeDTO findEmployees(@PathVariable("id") long employeeId) {
		return employeeService.findEmployee(employeeId);
	}

	/*
	 * @RequestMapping(value = "/json2/{id}", method = RequestMethod.GET,
	 * headers = {"Content-Type=application/json"})
	 * 
	 * @ResponseStatus(HttpStatus.NO_CONTENT) public void
	 * findEmployees2(@PathVariable("id") long employeeId) {
	 * employeeService.findEmployee(employeeId); }
	 */
}
